import matplotlib.pyplot as plt
import numpy as np

filename = "dataA.txt"
with open(filename, 'r') as f:
    lines = f.readlines()

x = np.linspace(0.99, 1.01, 101)
y0 = [float(s) for s in lines[0].split()]
y1 = [float(s) for s in lines[1].split()]
y2 = [float(s) for s in lines[2].split()]

plt.plot(x, y0, label="y=f(x)")
plt.plot(x, y1, label="y=g(x)")
plt.plot(x, y2, label="y=h(x)")
plt.xlabel("x")
plt.ylabel("y")
plt.title("Calculate the same function in different types.")
plt.legend()
plt.savefig("ProgrammingA.png")

print("Finish.")